# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=ruby-mechanize
_pkgname=mechanize
pkgver=2.14.0
pkgrel=2
pkgdesc='Automates interaction with websites, handling cookies, redirects and forms.'
arch=('any')
url='https://rubygems.org/gems/mechanize'
license=('GPL2')
depends=('ruby' 'ruby-net-http-digest_auth' 'ruby-net-http-persistent'
         'ruby-mime-types' 'ruby-http-cookie' 'ruby-nokogiri' 'ruby-ntlm-http'
         'ruby-webrobots' 'ruby-domain_name')
makedepends=('ruby' 'ruby-rdoc')
source=("https://rubygems.org/gems/$_pkgname-$pkgver.gem")
noextract=("$_pkgname-$pkgver.gem")
sha512sums=('563b79c116da1d438525d0c52f530323254612d081b3a5ca7633837cf052b55e8b09021effac06aea7b2895ce5a20f14b58a6fca1cfb2d66244092fed0454a76')

package() {
  _gemdir="$(ruby -e 'puts Gem.default_dir')"

  if [[ $CARCH == arm* ]] ; then
    gem install --no-user-install --ignore-dependencies --no-rdoc --no-ri \
      -i "$pkgdir$_gemdir" "$_pkgname-$pkgver.gem"
  else
    gem install --ignore-dependencies --no-user-install -i "$pkgdir/$_gemdir" \
      -n "$pkgdir/usr/bin" "$_pkgname-$pkgver.gem"
  fi
}

